package com.youlu.campus.admin.english;


import com.youlu.campus.common.base.RestResult;
import com.youlu.campus.common.base.RestResultBuilder;
import com.youlu.campus.entity.english.vo.request.ActivityFeeCreatedCommand;
import com.youlu.campus.entity.english.vo.request.UserCompetitionFeeQuery;
import com.youlu.campus.service.english.ActivityQaFeeService;
import com.youlu.campus.service.english.UserCompetitionFeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 英语竞赛报名费用配置类
 */
@RestController
public class ActivityFeeController {

   @Autowired
    private ActivityQaFeeService activityQaFeeService;

   @Autowired
   private UserCompetitionFeeService userCompetitionFeeService;

    @GetMapping("/activity-group/qa-fee/list")
    public RestResult list(){
        return RestResultBuilder.builder().success().data(activityQaFeeService.list()).build();
    }

    /**
     * 竞赛组答题费用添加
     * @param createdCommand
     * @return
     */
    @PostMapping("/activity-group/qa-fee/save")
    public RestResult save(@RequestBody ActivityFeeCreatedCommand createdCommand){
        activityQaFeeService.save(createdCommand);
        return RestResultBuilder.builder().success().build();
    }

    @GetMapping("/activity-group/qa-fee/detail")
    public RestResult detail (@RequestParam String activityGroupId,@RequestParam String feeTypeCode){
        return RestResultBuilder.builder().data(activityQaFeeService.detail(activityGroupId,feeTypeCode)).success().build();
    }

    @PostMapping("/activity-group/fee/list")
    public RestResult userFeeList(@RequestBody UserCompetitionFeeQuery userCompetitionFeeQuery){
        return RestResultBuilder.builder().data(userCompetitionFeeService.list(userCompetitionFeeQuery)).success().build();
    }








}
